<template>
  <a-card>
    <a-button @click="confirm" type="prmary">提示</a-button>
  </a-card>
</template>

<script>
export default {
  // mounted() {
  //   this.confirm();
  // },
  methods: {
    confirm() {
      this.$confirmModal({
        key: "test",
        title: "测试标题",
        content: "这是一些提示内容",
        onOk: this.fetchData
      });
    },
    fetchData() {
      return new Promise((resolve, reject) => {
        if (Math.random() > 0.5) {
          resolve("大于0.5");
          this.$message.success("成功");
        } else {
          reject("小于0.5");
          this.$message.error("失败");
        }
      });
    }
  }
};
</script>

<style>
</style>
